package com.ruoyi.board.controller;

import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.board.domain.StockBoardIndustrySummaryThs;
import com.ruoyi.board.service.IStockBoardIndustrySummaryThsService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 同花顺-同花顺行业一览表Controller
 * 
 * @author leng.xz
 * @date 2024-05-17
 */
@Controller
@RequestMapping("/board/IndustrySummaryThs")
public class StockBoardIndustrySummaryThsController extends BaseController
{
    private String prefix = "board/IndustrySummaryThs";

    @Autowired
    private IStockBoardIndustrySummaryThsService stockBoardIndustrySummaryThsService;

    @RequiresPermissions("board:IndustrySummaryThs:view")
    @GetMapping()
    public String IndustrySummaryThs()
    {
        return prefix + "/IndustrySummaryThs";
    }

    /**
     * 查询同花顺-同花顺行业一览表列表
     */
    @RequiresPermissions("board:IndustrySummaryThs:list")
    @PostMapping("/list")
    @ResponseBody
    public TableDataInfo list(StockBoardIndustrySummaryThs stockBoardIndustrySummaryThs)
    {
        startPage();
        List<StockBoardIndustrySummaryThs> list = stockBoardIndustrySummaryThsService.selectStockBoardIndustrySummaryThsList(stockBoardIndustrySummaryThs);
        return getDataTable(list);
    }

    /**
     * 导出同花顺-同花顺行业一览表列表
     */
    @RequiresPermissions("board:IndustrySummaryThs:export")
    @Log(title = "同花顺-同花顺行业一览表", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    @ResponseBody
    public AjaxResult export(StockBoardIndustrySummaryThs stockBoardIndustrySummaryThs)
    {
        List<StockBoardIndustrySummaryThs> list = stockBoardIndustrySummaryThsService.selectStockBoardIndustrySummaryThsList(stockBoardIndustrySummaryThs);
        ExcelUtil<StockBoardIndustrySummaryThs> util = new ExcelUtil<StockBoardIndustrySummaryThs>(StockBoardIndustrySummaryThs.class);
        return util.exportExcel(list, "IndustrySummaryThs");
    }

    /**
     * 新增同花顺-同花顺行业一览表
     */
    @GetMapping("/add")
    public String add()
    {
        return prefix + "/add";
    }

    /**
     * 新增保存同花顺-同花顺行业一览表
     */
    @RequiresPermissions("board:IndustrySummaryThs:add")
    @Log(title = "同花顺-同花顺行业一览表", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    @ResponseBody
    public AjaxResult addSave(StockBoardIndustrySummaryThs stockBoardIndustrySummaryThs)
    {
        return toAjax(stockBoardIndustrySummaryThsService.insertStockBoardIndustrySummaryThs(stockBoardIndustrySummaryThs));
    }

    /**
     * 修改同花顺-同花顺行业一览表
     */
    @GetMapping("/edit/{id}")
    public String edit(@PathVariable("id") Long id, ModelMap mmap)
    {
        StockBoardIndustrySummaryThs stockBoardIndustrySummaryThs = stockBoardIndustrySummaryThsService.selectStockBoardIndustrySummaryThsById(id);
        mmap.put("stockBoardIndustrySummaryThs", stockBoardIndustrySummaryThs);
        return prefix + "/edit";
    }

    /**
     * 修改保存同花顺-同花顺行业一览表
     */
    @RequiresPermissions("board:IndustrySummaryThs:edit")
    @Log(title = "同花顺-同花顺行业一览表", businessType = BusinessType.UPDATE)
    @PostMapping("/edit")
    @ResponseBody
    public AjaxResult editSave(StockBoardIndustrySummaryThs stockBoardIndustrySummaryThs)
    {
        return toAjax(stockBoardIndustrySummaryThsService.updateStockBoardIndustrySummaryThs(stockBoardIndustrySummaryThs));
    }

    /**
     * 删除同花顺-同花顺行业一览表
     */
    @RequiresPermissions("board:IndustrySummaryThs:remove")
    @Log(title = "同花顺-同花顺行业一览表", businessType = BusinessType.DELETE)
    @PostMapping( "/remove")
    @ResponseBody
    public AjaxResult remove(String ids)
    {
        return toAjax(stockBoardIndustrySummaryThsService.deleteStockBoardIndustrySummaryThsByIds(ids));
    }
}
